#ifndef __SAMPLE_UTIL_H
#define __SAMPLE_UTIL_H

#include "lyn_api.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
  SAMPLE_DRAW_COLOR_WHITE,
  SAMPLE_DRAW_COLOR_BLACK,
  SAMPLE_DRAW_COLOR_RED,
  SAMPLE_DRAW_COLOR_GREEN,
  SAMPLE_DRAW_COLOR_BLUE,
  SAMPLE_DRAW_COLOR_YELLOW,
  SAMPLE_DARW_COLOR_CYAN
} DrawColor;

typedef enum {
  SAMPLE_DRAW_THICK_2 = 2,
  SAMPLE_DRAW_THICK_4 = 4,
  SAMPLE_DRAW_THICK_6 = 6,
  SAMPLE_DRAW_THICK_8 = 8
} DrawThick;

typedef enum {
  SAMPLE_FONT_SIZE_18 = 18,
  SAMPLE_FONT_SIZE_24 = 24,
  SAMPLE_FONT_SIZE_36 = 36,
  SAMPLE_FONT_SIZE_48 = 48,
  SAMPLE_FONT_SIZE_64 = 64,
  SAMPLE_FONT_SIZE_96 = 96,
  SAMPLE_FONT_SIZE_128 = 128
} FontSize;

typedef struct {
  uint32_t startX;
  uint32_t startY;
  uint32_t imgW;
  uint32_t imgH;
  lynPixelFormat_t imgFmt;
  FontSize fontSize;
  unsigned char *imgData;
#if __WORDSIZE == 32
  uint32_t reserve;
#endif
  char *text;
#if __WORDSIZE == 32
  uint32_t reserve_1;
#endif
} __attribute__((packed)) DrawTextAttr;

typedef struct {
  uint32_t startX;
  uint32_t startY;
  uint32_t imgW;
  uint32_t imgH;
  lynPixelFormat_t imgFmt;
  FontSize fontSize;
  DrawColor color;
  unsigned char *imgData;
#if __WORDSIZE == 32
  uint32_t reserve;
#endif
  wchar_t *text;
#if __WORDSIZE == 32
  uint32_t reserve_1;
#endif
} __attribute__((packed)) DrawTextAttrV2;

typedef struct {
  uint32_t x;
  uint32_t y;
} DarwPoint;

typedef struct {
  DarwPoint startPoint;
  DarwPoint endPoint;
  uint32_t imgW;
  uint32_t imgH;
  lynPixelFormat_t imgFmt;
  DrawThick thickness;
  DrawColor color;
  unsigned char *imgData;
#if __WORDSIZE == 32
  uint32_t reserve;
#endif
} __attribute__((packed)) DrawLineAttr;

/**
 * @brief draw text on frame
 *
 * @param  attr
 * @return int
 */
int PluginDrawText(DrawTextAttr *attr);

/**
 * @brief draw wchar text on frame
 *
 * @param  attr
 * @return int
 */
int PluginDrawTextV2(DrawTextAttrV2 *attr);

#ifdef __cplusplus
}
#endif

#endif